home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
How Would You Survive?
/
How Would You Survive (1995)(Grolier)[Mac-PC].iso
/
mac
/
SHARED.DIR
/
01982_Script_a3StateButton
< prev
next >
Wrap
Text File
|
1995-09-13
|
4KB
|
159 lines
property pSprite,pCast,pNutral,pHilighted,pSelected,pFunction,pMySound,pCursor,¼
pbeenClicked,phelpStatus
on birth me,theSprite,theCast,aSound,aFunction,aCursor
-- assumes that the sprite has the correct cast member in the correct loc
-- assumes that the normal and depressed art are in cast numbers theCast and theCast + 1
set pSprite = theSprite
set pcursor = aCursor
set pCast = theCast
set pMySound = aSound
set pNutral = pCast
set pHilighted = pCast + 1
set pSelected = pCast + 2
set pFunction = aFunction
set phelpStatus = 0
puppetSprite pSprite, TRUE
set the castNum of sprite pSprite = pCast
return me
end
on setNewFunction me, aFunction
set pFunction = aFunction
end
on setNewSound me, aNewSound
set pMySound = aNewSound
end
on TurnOnHelpSound me
set phelpStatus = 1
end
on TurnOffHelpSound me
set phelpStatus = 0
end
on reset me
set the castNum of sprite pSprite = pNutral
updatestage
end
on hilight me
puppetsprite pSprite, true
set pbeenClicked to False
puppettransition 0
set the cursor of sprite pSprite = [1904, 1905]
repeat while (rollover(pSprite))
if the castNum of sprite pSprite = pNutral then
set the castNum of sprite pSprite = pHilighted
if phelpStatus = 1 then
puppetsound pMySound
UpDateStage
end if
set pbeenClicked to False
Updatestage
if soundBusy(3) then
exit repeat
end if
else
if (the mouseDown) then
if (not(the castNum of sprite pSprite = pSelected)) then
puppetsound "FeatureButSplClk.AIFF"
updatestage
end if
set the castNum of sprite pSprite = pSelected
set pbeenClicked to TRUE
Updatestage
else
-- the mouse is up
if (pbeenClicked = true and rollover(pSprite)) then
set the cursor of sprite pSprite = [1910, 1911]
reset me
do pFunction
return FALSE
else
if soundBusy(3) then
exit repeat
end if
end if
end if
end if
end repeat
if phelpStatus = 1 then
puppetsound 0
end if
if rollover(pSprite) then
if (the castNum of sprite pSprite = pHilighted) then
return TRUE
else
set the castNum of sprite pSprite = pHilighted
return TRUE
end if
else
if (the castNum of sprite pSprite = pHilighted) then
reset me
return FALSE
else
return FALSE
end if
end if
end
on Donthilight me
puppettransition 0
set checksoundstatus = 0
repeat while (rollover(pSprite))
if checksoundstatus = 0 then
if phelpStatus = 1 then
puppetsound pMySound
UpDateStage
set checksoundstatus = 1
end if
else
nothing
end if
end repeat
if phelpStatus = 1 then
puppetsound 0
end if
end
on toggle me
set the castNum of sprite pSprite = pSelected
upDateStage
repeat while (the mouseDown)
if rollover(pSprite) then
set the castNum of sprite pSprite = pSelected
set pbeenClicked to true
else
set the castNum of sprite pSprite = pNutral
set pbeenClicked to false
end if
updatestage
end repeat
end
on hideControl me
puppetSprite pSprite, FALSE
set the cursor of sprite pSprite = 0
end
on showControl me
puppetSprite pSprite, TRUE
set the cursor of sprite pSprite = [1904, 1905]
end
on changeBaseButton me, newBase
set pCast = newBase
set the castNum of sprite pSprite = pCast
showControl(me)
end
on setDemoHilight me
set the castNum of sprite pSprite = pHilighted
upDateStage
end